#pragma once
#include "stdafx.h"
//#include "DelaySet.h"

#include "DelayDevice.h"

#define   MSGLEN	10240
#define   DATA_DEV	0
#define   DATA_BEG  1

 

class CMsgRecv
{
public:
	CMsgRecv(void);
	~CMsgRecv(void);
public:
	void SetHwnd(HWND hwnd);
	int Clean(void);
	int SetMode(unsigned int mode);
	int GetIO(unsigned int *val);
	int SetIO(int chl,unsigned int val);
	WORKMODE GetMode(void);

public:
	static void ParseRecvMsg(void* obj, char* buf, int len,SOCKET socket);

	void RecvSerialMsg(char* buf, int len);
	void ParseDetail(BYTE * data,int len);
	BYTE m_msg[MSGLEN],m_Parsemsg[MSGLEN];
	int  m_beginMsg;
	int  m_num,m_PLen,m_len,m_len2;
	bool m_bContinue;
	CString recvtmp;

	//unsigned int m_iIO_I[ONE_DEVICE_IO_I];
	unsigned int m_iIO_O[2]; 
	WORKMODE m_mode;
	bool     m_bIOGet;
	HWND     m_hwnd;
};

